﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ConstructionBidOnline.Biz;

public partial class ContractorPublicProfile : System.Web.UI.Page
{

    #region Constants

    private const string PROP_DATASRC_CERTIFICATES = "__CERTIFICATES::CERTIFICATES";

    private const string PROP_DATASRC_LICENSE = "__LICENSE::LICENSE";

    private const string PROP_DATASRC_BIDS = "__BIDS::BIDS";

    private const string PROP_DATASRC_PORTFOLIOIMAGES = "__PORTFOLIOIMAGES::PORTFOLIOIMAGES";

    private const string PROP_DATASRC_PORTFOLIOVIDEOS = "__PORTFOLIOVIDEOS::PORTFOLIOVIDEOS";

    #endregion

    #region Public Properties

    
    public CertificatesCollection DataSourceCertificates
    {
        get { return (SessionMgr.Session[PROP_DATASRC_CERTIFICATES] is CertificatesCollection ? (CertificatesCollection)SessionMgr.Session[PROP_DATASRC_CERTIFICATES] : (CertificatesCollection)(SessionMgr.Session[PROP_DATASRC_CERTIFICATES] = new CertificatesCollection())); }
        set { SessionMgr.Session[PROP_DATASRC_CERTIFICATES] = value; }
    }

    public LicenseCollection DataSourceLicense
    {
        get { return (SessionMgr.Session[PROP_DATASRC_LICENSE] is LicenseCollection ? (LicenseCollection)SessionMgr.Session[PROP_DATASRC_LICENSE] : (LicenseCollection)(SessionMgr.Session[PROP_DATASRC_LICENSE] = new LicenseCollection())); }
        set { SessionMgr.Session[PROP_DATASRC_LICENSE] = value; }
    }

    public BidCollection DataSourceBids
    {
        get { return (SessionMgr.Session[PROP_DATASRC_BIDS] is BidCollection ? (BidCollection)SessionMgr.Session[PROP_DATASRC_BIDS] : (BidCollection)(SessionMgr.Session[PROP_DATASRC_BIDS] = new BidCollection())); }
        set { SessionMgr.Session[PROP_DATASRC_BIDS] = value; }
    }

    public PortfoliosCollection DataSourcePortfolioImages
    {
        get { return (SessionMgr.Session[PROP_DATASRC_PORTFOLIOIMAGES] is PortfoliosCollection ? (PortfoliosCollection)SessionMgr.Session[PROP_DATASRC_PORTFOLIOIMAGES] : (PortfoliosCollection)(SessionMgr.Session[PROP_DATASRC_PORTFOLIOIMAGES] = new PortfoliosCollection())); }
        set { SessionMgr.Session[PROP_DATASRC_PORTFOLIOIMAGES] = value; }
    }

    public PortfoliosCollection DataSourcePortfolioVideos
    {
        get { return (SessionMgr.Session[PROP_DATASRC_PORTFOLIOVIDEOS] is PortfoliosCollection ? (PortfoliosCollection)SessionMgr.Session[PROP_DATASRC_PORTFOLIOVIDEOS] : (PortfoliosCollection)(SessionMgr.Session[PROP_DATASRC_PORTFOLIOVIDEOS] = new PortfoliosCollection())); }
        set { SessionMgr.Session[PROP_DATASRC_PORTFOLIOVIDEOS] = value; }
    }

    public ProfileImages profileimageObj;

    #endregion

    #region Public Variables

    public RegisteredUser contractorObj;
    public CompanyInformation companyInfoObj;
    public Contracts contractObj;
    public int TotalJobCount = 0;
    public int TotalRating = 0;

    #endregion

    #region Event Handlers

    #region Page Load

    protected void Page_Load(object sender, EventArgs e)
    {
        contractorObj = RegisteredUser.GetRegisteredUserByID(Int32.Parse(Request.QueryString["cid"].ToString()));
        companyInfoObj = CompanyInformation.GetCompanyInformationByID(contractorObj.RegisteredUserID);
        DataSourceCertificates = Certificates.GetCertificatesByUserID(contractorObj.RegisteredUserID);
        DataSourceLicense = License.GetLicenseByUserID(contractorObj.RegisteredUserID);
        DataSourceBids = Bid.GetBidByCompanyID(contractorObj.RegisteredUserID);
        DataSourcePortfolioImages = Portfolios.GetPortfoliosByUserIDnFileType(contractorObj.RegisteredUserID,"Image");
        DataSourcePortfolioVideos = Portfolios.GetPortfoliosByUserIDnFileType(contractorObj.RegisteredUserID, "Video");
        profileimageObj = ProfileImages.GetProfileImage(contractorObj.RegisteredUserID);
    }

    #endregion

    #endregion

}
